<!DOCTYPE html>
<html>
<head>
    <title>接口注册</title>
    <#include "/common/import.ftl" >
    <script type="text/javascript" src="${ctx!''}/js/utiltools.js"></script>
    <script type="text/javascript" src="${ctx!''}/js/easyui/extendvalidate.js"></script>
    <script type="text/javascript">
        var inputForm = '#inputForm';
        $(function () {
            $(inputForm).form({
                success: function (data) {
                    var result = jQuery.parseJSON(data);
                    if (result.flag == 'T') {
                        $.messager.confirm('提交结果', '操作成功', function () {
                            parent.colseAdd();// 关闭添加窗口
                            parent.cateReload();// 刷新列表
                        });
                    } else if (result.flag == 'H') {
                        $.messager.alert('提交结果', result.msg, 'info');
                    } else {
                        $.messager.alert('提交结果', '操作失败', 'error');
                    }
                },
                error: function (messg) {
                    $.messager.alert('错误提示', messg.responseText, 'error');
                }
            });
            $('#beanId').focus();
        });

        function doSubmit() {
            var flag = $(inputForm).form('validate');
            if (flag) {
                //UtilTools.showProcess('正在提交数据...');
                $(inputForm).submit();
            }
        }
    </script>
</head>
<body>

<form id="inputForm" name="inputForm" method="post" action="${ctx!''}/protocol/save.action">
    <input type="hidden" name="formToken" id="formToken" value="${formToken!''}"/>
    <input type="hidden" name="registerId" id="registerId" value="${item.registerId!''}"/>
    <table class="datagrid-body">
        <tr>
            <td class="datagrid-header">beanID<font color=red>*</font></td>
            <td>
                <input id="beanId" name="beanId" value="${item.beanId!''}"
                       class="easyui-validatebox" data-options="required:true" size="40"
                       missingMessage="请输入beanID"/>
            </td>
        </tr>
        <tr>
            <td class="datagrid-header">bean名称</td>
            <td>
                <input id="beanName" name="beanName" value="${item.beanName!''}"
                       class="easyui-validatebox" size="40"
                       missingMessage="请输入beanName"/>
            </td>
        </tr>
        <tr>
            <td class="datagrid-header">方法标识<font color=red>*</font></td>
            <td>
                <input name="methodName" id="methodName" value="${item.methodName!''}"
                       class="easyui-validatebox" data-options="required:true,validType:'english'"
                       size="40"
                       missingMessage="请输入方法标识" invalidMessage=""/>
            </td>
        </tr>
        <tr>
            <td class="datagrid-header">协议<font color=red>*</font></td>
            <td>
                <select name="callType" id="callType">
                    <option value="">--请选择--</option>
                    <option value="http">HTTP协议</option>
                    <option value="https">HTTPS协议</option>
                    <option value="socket">SOCKET协议</option>
                    <option value="webservice">WEBSERVICE协议</option>
                    <option value="internal">内部</option>
                </select>
            </td>
        </tr>
        <tr>
            <td class="datagrid-header">访问地址<font color=red>*</font></td>
            <td>
                <input name="address" id="address" value="${item.address!''}"
                       class="easyui-validatebox" data-options="required:false" size="40"
                       missingMessage="请输入访问地址" invalidMessage=""/>
            </td>
        </tr>
        <tr>
            <td class="datagrid-header">端口</td>
            <td>
                <input id="port" name="port" value="${item.port!''}"
                       class="easyui-validatebox" data-options="required:false" size="40"/>
            </td>
        </tr>
        <tr>
            <td class="datagrid-header">版本号</td>
            <td>
                <input id="reserve2" name="reserve2" value="${item.reserve2!''}"
                       class="easyui-validatebox" data-options="required:false" size="40"/>
            </td>
        </tr>
        <tr>
            <td class="datagrid-header">状态<font color=red>*</font></td>
            <td>
                <input type="radio" name="flag" id="flag_1" value="1" checked="checked"/>启用
                <input type="radio" name="flag" id="flag_0" value="0"/>停用
            </td>
        </tr>
        <tr>
            <td class="datagrid-header">描述</td>
            <td>
                <textarea name="reserve1" rows="3" cols="60">${item.reserve1!''}</textarea>
            </td>
        </tr>
        <tr>
            <td class="datagrid-header"></td>
            <td>
                <a href="#" class="easyui-linkbutton" id="bt1" iconCls="icon-save"
                   onclick="doSubmit();">提交</a>
                <a href="#" class="easyui-linkbutton" iconCls="icon-cancel"
                   onclick="parent.colseAdd();" ;>取消</a>
            </td>
        </tr>
    </table>
</form>
</body>
</html>
<script>
    UtilTools.initRadio("flag", "${item.flag!''}");
    UtilTools.initSelect("callType", "${item.callType!''}");
</script>